package com.king.designpatterns.行为模式.解释器模式;

/**
 * 非终结符表达式 - 加
 *
 * @author king
 * @date 2021-06-11 14:29
 */
public class Plus implements ArithmeticExpression{
    ArithmeticExpression left;
    ArithmeticExpression right;

    public Plus(ArithmeticExpression left, ArithmeticExpression right) {
        this.left = left;
        this.right = right;
    }

    @Override
    public int interpret(Variables variables) {
        return left.interpret(variables) + right.interpret(variables);
    }
}
